;#11111.("description") = {"An interface to Gopher internet services.", "Copyright (c) 1992,1993 Grump,JoeFeedback@LambdaMOO.", "", "This object contains just the raw verbs for getting data from gopher servers and parsing the results. Look at #50122 (Generic Gopher Slate) for one example of a user interface. ", "", ":get(site, port, selection)", " Get data from gopher server: returns a list of strings, or an error if it couldn't connect. Results are cached.", "", ":get_now(site, port, selection)", " Like $gopher:get, but bypass the cache (used by $gopher:get).", "", ":show_text(who, start, end, site, port, selection)", " Requires wiz-perms to call.", " like who:notify_lines($gopher:get(..node..)[start..end])", "", ":clear_cache()", " Erase the gopher cache.", "", ":parse(string)", " Takes a directory line as returned by $gopher:get, and return a list", " {host, port, selector, label}", " host, port, and selector are what you send to :get.", " label is a string, where the first character is the type code.", "", ":type(char)", " returns the name of the gopher type indicated by the character, e.g.", " $gopher:type(\"I\") => \"image\"", ""}
@verb #11111:"get_now" this none this rx
@program #11111:get_now
"Usage: get_now(site, port, message)";
"Returns a list of strings, or an error if we couldn't connect.";
"disallow connections to low number ports; necessary?";
return E_INVARG;
endif
opentime = time();
con = $network:open(args[1], args[2]);
opentime = (time() - opentime);
if (typeof(con) == ERR)
return con;
endif
read(con);
"eliminate blank line";
notify(con, args[3]);
results = {};
count = this.limit;
"perhaps this isn't necessary, but if a gopher source is slowly spewing things, perhaps we don't want to hang forever -- perhaps this should just fork a process to close the connection instead?";
;#22222.("help_msg") = {"Moving around:", " pick <item> on slate", " select the given menu item (either a number or partial name).", " If it is a text item, it will show it to you.", " <number> on slate", " e.g., 12 on slate. You can omit `pick' when chosing items", " by their number.", " back slate [for n]", " go back up a level; with n supplied, goes back n levels", " reset slate", " reset slate to the default list of `remember'-ed nodes", " goto host [port [path]] on slate", " make a direct jump to a specified host. Please be careful --", " at the moment this slows everyone down if the host isn't valid.", "", "Controlling noise:", " ignore slate", " stop listening when other people fiddle with the slate", " watch slate", " start watching while other people fiddle with the slate", " show slate to person", " show the contents of the slate to someone even if they're not watching", "", "Bookmarks:", " remember [<item>] on slate", " adds item to the default of nodes", " will prompt you for title", " remember on slate", " remembers the current menu choice rather than any ", " particular item", " forget <item> on slate", " (only when looking at the default list)", " deletes the given item", "", "In long menus and text:", " next [<n>] on slate", " prev [<n>] on slate", " move you forward/backward in the set of visible menu items.", " You can give a `number of pages' to move forward.", " read slate", " show you the entire contents of the slate", "", "Miscellaneous:", " stack slate", " show stack, where `back' will go", " details <item> on slate", " show host, port number, and selection string for a given item. ", " mailme slate", " if you have a valid registration address: send mail with the", " slate contents to your email address.", "", "When you first make a gopher slate, you will need to use `goto'", "and then `remember' to set up the default list of nodes."}
@prop #22222."locked" 0 r
@prop #22222."ignoring" {} r
@prop #22222."watching" {} r
@prop #22222."controlled" #-1 r
@prop #22222."work_with_msg" "%N %<starts> to work with %d." rc
;#22222.("description") = "A laptop size computer, with various controls on it."
@verb #22222:"p*ick" any on this rxd
@program #22222:pick
"pick <entry> on slate";
" entry is either a line number or an initial substring of a line description";
" select that entry: if it is a menu, go to that node. If it is a search,";
" asks you for the search term & does the search.";
" Some kinds of nodes are not implemented.";
if (this:_textp() || (!(this.stack || this.remembered)))
return player:tell("There's nothing to pick.");
endif
if (this:busy("picking"))
return;
endif
if (!(which = this:match_choice(dobjstr)))
"match_choice took care of it.";
this:busy(0);
return;
endif
if ((tostr(tonum(dobjstr)) == dobjstr) && (!({player, @this:_place()} in this.seen)))
player:tell($string_utils:pronoun_sub("Oooops, perhaps you should look at the %t first."));
this:busy(0);
return;
endif
parse = $gopher:parse(this.value[which]);
desc = this.desclines[which];
this:announce_op("%N %<picks> '", desc, "' on the %t.");
this:do_pick(@parse);
return;
.
@verb #22222:"reset" this none none rxd
@program #22222:reset
"reset slate";
" reset the slate to its set of 'remembered' selections";
if (why = this:is_locked(player))
return player:tell($string_utils:pronoun_sub("Sorry, %t seems to be "), why, ".");
elseif (this:busy("resetting"))
return;
endif
this:announce_op("%N %<resets> the %t.");
this.seen = {};
this:set_pointer();
this:busy(0);
.
@verb #22222:"pop back" any any any rxd
@program #22222:pop
"back this [by <n>]";
" move back up the gopher stack to the previous menu";
" or previous N menus.";
n = 1;
if (iobjstr && (!(iobjstr == tostr(n = tonum(iobjstr)))))
return player:tell("Sorry, '", iobjstr, "' doesn't look like a number.");
endif
if (length(this.stack) < n)
player:tell("Sorry, there aren't ", n, " levels to go back.");
return;
endif
if (this:busy("going back"))
return;
endif
this:announce_op("%N %<goes> back up ", (n == 1) ? "a level" | tostr(n, " levels"), " on the %t.");
who:tell_lines(this.desclines || {$string_utils:pronoun_sub("%T is empty right now.")});
if (header)
who:tell("--------------- ", this.name, "-----");
endif
endif
.
@verb #22222:"next prev*ious" any on this rxd
@program #22222:next
if (this:busy("reading"))
"can't 'next' if it is busy";
return;
endif
this:busy(0);
n = (tonum(dobjstr) || 1);
if (verb != "next")
n = (-n);
verb = "previous";
endif
offset = this:offset();
new = (offset + (n * this.length));
if (new < 1)
if (offset == 1)
return player:tell("You're already at the beginning.");
else
new = 1;
endif
elseif (new > length(this.desclines))
return player:tell("You're already at the end.");
endif
this:announce_op("%N %<looks> at the ", verb, " ", this:_textp() ? "page" | "results", " on the %t.");
this:offset(new);
this:show_results();
.
@verb #22222:"initialize" this none this
@program #22222:initialize
if ((caller == this) || $perm_utils:controls(caller_perms(), this))
"don't call this unless you mean it.";
this.seen = {};
this.desclines = {};
"The default is that slate's inherit the 'remembered' from their parent. This means, though, that they're initially blank but have to be 'reset' to fire up. See :do_reset";
;#33333.("description") = {"Utilities for dealing with network connections", "---------------", "Creating & tracking hosts:", "", ":open(host, port [, connect-connection-to]) => {connection, object}", " open a network connection (using open_network_connection), optionally", " allows for it to be connected to another object.", " (see #0:do_login_command for details).", "", ":close(connection)", " closes the connection & cleans up data", "", "------------------", "Parsing network things:", "", ":invalid_email_address(email)", " return \"\" or string saying why 'email' is invalid.", " uses .valid_email_regexp", "", ":invalid_hostname(host)", " return \"\" or string saying why 'host' doesn't look", " like a valid internet host name", "", ":local_domain(host)", " returns the 'important' part of a host name, e.g.", " golden.parc.xerox.com => parc.xerox.com", "", "-------------------", "Sending mail", "", ":sendmail(to, subject, @lines)", " send mail to the email address 'to' with indicated subject.", " header fields like 'from', 'date', etc. are filled in.", " lines can start with additional header lines.", "", ":raw_sendmail(to, @lines)", " used by :sendmail. Send mail to given user at host, just", " as specified, no error checking.", "", "================================================================", "Parameters:", "", ".active If 0, disabled sending of mail.", "", ".site Where does this MOO run?", " (Maybe MOOnet will use it later).", "", ".port The network port this MOO listens on.", "", ".large_domains ", " A list of sites where more than 2 levels of host name are", " significant, e.g., if you want 'parc.xerox.com' to be", " different than 'cinops.xerox.com', put \"xerox.com\" as an", " element in .large_domains.", "", ".postmaster", " Email address to which problems with MOO mail should", " go. This should be a real email address that someone reads.", "", ".maildrop", " Hostname to connect to for dropping off mail. Usually can", " just be \"localhost\".", "", ".reply_address", " If a MOO character sends email, where does a reply go?", " Inserted in 'From:' for mail from characters without", " registration addresses. ", "", ".trusts", " List of (non-wizard) programmers who can call", " :open, :sendmail, :close", "", " "}
;#33333.("object_size") = {11843, 741006149}
@verb #33333:"parse_address" this none this
@program #33333:parse_address
"Given an email address, return {userid, site}.";
"Valid addresses are of the form `userid[@site]'.";
"At least for now, if [@site] is left out, site will be returned as blank.";
"Should be a default address site, or something, somewhere.";
"Open a network connection to address/port. If the connect-connection-to is passed, then the connection will be connected to that object when $login gets ahold of it. If not, then the connection is just ignored by $login, i.e. not bothered by it with $welcome_message etc.";
"The object specified by connect-connection-to has to be a player (though it need not be a $player).";
"Returns the (initial) connection or an error, as in open_network_connection";